package com.showsu.editor.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author edison
 * 0:待支付,1:支付中,2:支付成功,3:关闭,4::失败
 */

@Getter
@AllArgsConstructor
public enum PayStatusEnum {

    Waiting_pay(0, "Waiting_pay","待支付"),
    PayIng(1, "PayIng","支付中"),
    Success(2, "SUCCESS", "支付成功"),
    Closed(3, "Closed","关闭"),
    Fail(4, "FAIL","失败"),
    ;

    /**
     * 编码
     */
    final Integer code;
    /**
     * 描述-英文
     */
    final String msgEn;
    /**
     * 描述-中文
     */
    final String msgCh;

    public static PayStatusEnum getByCode(Integer code){
        if (code == null) {
            return null;
        }
        for (PayStatusEnum payStatusEnum : PayStatusEnum.values()) {
            if (payStatusEnum.getCode().equals(code)) {
                return payStatusEnum;
            }
        }
        return null;
    }
}
